Skip to content

Added type_insensitive parameter for equals_string_part operator#1787

Open
aniemes wants to merge 5 commits into
mainfrom
1665_string_part_type_insensitive
Open

Added type_insensitive parameter for equals_string_part operator#1787
aniemes wants to merge 5 commits into
mainfrom
1665_string_part_type_insensitive

Conversation

@aniemes

@aniemes aniemes commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…. Added tests for this and a negative test for the original operator without the param

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated schema has not been merged with markdown descriptions. Please run the "Merge Schema with Markdown Descriptions" workflow to update the merged schema files.

Comment thread resources/schema/rule/Operator.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks great to me. I will recommend minor updates to the tests for covering the edge cases of

  1. No regex match
  2. Empty string/null target
  3. Case for deos_not_equal_string_part False
  4. Test for leading zero behavior.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ramil,
Thank you for reviewing it! I will work on the changes now to cover the edge cases and update the Operator.md file as you said above.
Thanks!
Adam

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RamilCDISC
So I am having some trouble with the 'no regex' as this seems to be expected. I added this into a new test case:
if operator == "equals_string_part": result = dataframe_type.equals_string_part( { "target": "target", "comparator": comparator, "regex": "(.*)", "type_insensitive": True, } )

But this is still using regex. Can you suggest how to test this without using regex? I am also have trouble with the empty string/null targets.

I tried this:
( {"VAR2": ["", ""], "target": [0, 0]}, "VAR2", "equals_string_part", PandasDataset, [True, True], )
And an empty target array but neither worked.

Pasted test file for reference.

test_string_comparison.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention with 'no regex match' was to ask for a test where the regex does not return any match, not to test without a regex. I see that my comment was not very clear. The edge cases I requested is to have a case where the passed regex does not return any match. Passing a regex is required.

For the null/empty target case, your example has empty values in VAR2 not in the target. target is '[0,0]'. I would test it with explicit empty/null values in target columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow type_insensitive parameter for does_not_equal_string_part and equals_string_part operators

3 participants